apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ $.Chart.Name }}-11-message-parser
  namespace: {{ index .Values "logstash" "namespace" }}
data:
  11-message-parser.conf: |-
    filter {
      if [kubernetes][labels][app] == "vertcoind-haproxy" {
        grok {
          match => { "log" => "%{TIMESTAMP_ISO8601:} localhost haproxy\[%{INT}\]: {%{GREEDYDATA:realmessage}}" }
        }
      }
      else if [kubernetes][labels][app] == "vertcoind-indexer" {
         grok {
           match => { "message" => "\[%{WORD:logsource}\]" }
         }
      }
      else if [kubernetes][labels][app] == "vertcoind-insightapi-ws" {
         grok {
           match => { "message" => "\[%{WORD:logsource}\]" }
         }
      }
      else if [kubernetes][labels][app] == "vertcoind-insightapi-http" {
         grok {
           match => { "log" => "\[%{WORD:logsource}\]" }
         }
      }
      else if [kubernetes][labels][app] =~ "vertcoind-node" {
         grok {
           match => { "log" => "%{TIMESTAMP_ISO8601:} %{WORD:node_logtype}: new best=%{WORD:node_newbest} height=%{NUMBER:node_height:int} version=%{WORD:node_version} log2_work=%{NUMBER:node_log2work:int} tx=%{NUMBER:node_tx:int} date=\'%{TIMESTAMP_ISO8601:node_date}\' progress=%{NUMBER:node_progress:float} cache=%{WORD:node_cache}" }
         }
      }
    }